<template>
  <div style="position: relative;width: 1200px">
    <el-card >
      <div style="position: relative">
       <p align="left">企业信息</p>
      </div>
      <hr>
      <p align="left" style="font-size: 15px">企业logo：</p>
      <!--   上传组件开始   -->
      <el-upload
          v-model:file-list="fileList"
          name="file"
          :limit="1"
          action="http://localhost:8080/v1/upload"
          list-type="picture-card"
          :on-preview="handlePictureCardPreview"
          :on-remove="handleRemove"
      >
        <el-icon><Plus /></el-icon>
      </el-upload>

      <el-dialog v-model="dialogVisible">
        <img w-full :src="dialogImageUrl" alt="Preview Image" />
      </el-dialog>
      <!--   上传组件结束   -->
      <el-form>
        <el-form-item style="width: 400px" label="企业名称"><el-input placeholder="请输入公司名称" v-model="upuser.companyName"></el-input> </el-form-item>
        <el-form-item style="width: 400px" label="企业邮箱"><el-input placeholder="请输入公司邮箱"></el-input> </el-form-item>
        <el-form-item style="width: 400px" label="所属行业"><el-input placeholder="请输入公司名称"></el-input> </el-form-item>
        <el-form-item style="width: 400px" label="联系人姓名"><el-input placeholder="请输入公司名称"></el-input> </el-form-item>
        <el-form-item style="width: 400px" label="联系电话"><el-input placeholder="请输入公司名称"></el-input> </el-form-item>
        <el-form-item style="width: 400px" label="公司地址"><el-input placeholder="请输入公司地址"></el-input> </el-form-item>
      </el-form>

    </el-card>
    <el-card style="position: fixed;width: 1200px;">
      <div style="position: relative;margin-left: 1000px">
      <el-button>取消</el-button><el-button type="primary" @click="save()">保存</el-button>
      </div>
    </el-card>
  </div>
</template>

<script setup>
import { ref } from 'vue'
import qs from "qs";
import axios from "axios";
import {ElMessage} from "element-plus";
/*上传组件开始*/
const fileList = ref([])
const dialogImageUrl = ref('')
const dialogVisible = ref(false)
const user = ref(localStorage.user?JSON.parse(localStorage.user):null);
const upuser=ref({})
const handleRemove = (uploadFile, uploadFiles) => {

  axios.post('http://localhost:8080/v1/remove?imgUrl='+uploadFile.response.data)
      .then((response)=>{
        if (response.data.code==2001){
          ElMessage.success("服务器文件删除完成!");
        }
      })

}
const handlePictureCardPreview = (uploadFile) => {
  dialogImageUrl.value = uploadFile.url
  dialogVisible.value = true
}
/*上传组件结束*/
</script>

<style scoped>

</style>